#ifndef ENTITY_H
#define ENTITY_H

#include <support/pie.h>

const QStringList statement=
{
    "query","columns",
    "queryByName","queryByCode","getCodeByName",
    "queryRaw","queryCustom","customColumns"
};

class Entity : public Pie
{
public:
    Entity(){}

    void setFileName(const QString &fileName)
    {
        fileName_=fileName;
    }

    bool load()
    {
        return Pie::load(fileName_);
    }

    bool save()
    {
        return Pie::save(fileName_);
    }

    QString query() const
    {
        return value(__FUNCTION__).toString();
    }

    QString queryRaw() const
    {
        return value(__FUNCTION__).toString();
    }

    QString queryByName() const
    {
        return value(__FUNCTION__).toString();
    }

    QString queryByCode() const
    {
        return value(__FUNCTION__).toString();
    }

    QString getCodeByName() const
    {
        return value(__FUNCTION__).toString();
    }

    QString queryCustom() const
    {
        return value(__FUNCTION__).toString();
    }

    QStringList columns() const
    {
        QString item=value(__FUNCTION__).toString();
        return item.split(",");
    }

    QStringList customColumns() const
    {
        QString item=value(__FUNCTION__).toString();
        return item.split(",");
    }

private:
    QString fileName_;
};

#endif // ENTITY_H
